<!DOCTYPE html>
<html>
<head>
<title>InnoDB free: 233472 kB</title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta
	content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"
	name="viewport">
<link rel="stylesheet" href="../../static/css/bootstrap.min.css">
<link rel="stylesheet" href="../../static/css/font-awesome.min.css">
<link rel="stylesheet"
	href="../../static/plugins/jqgrid/ui.jqgrid-bootstrap.css">
<link rel="stylesheet"
	href="../../static/plugins/ztree/css/metroStyle/metroStyle.css">
<link rel="stylesheet" href="../../static/css/main.css">
<script src="../../static/libs/jquery.min.js"></script>
<script src="../../static/plugins/layer/layer.js"></script>
<script src="../../static/libs/bootstrap.min.js"></script>
<script src="../../static/libs/vue.min.js"></script>
<script src="../../static/plugins/jqgrid/grid.locale-cn.js"></script>
<script src="../../static/plugins/jqgrid/jquery.jqGrid.min.js"></script>
<script src="../../static/plugins/ztree/jquery.ztree.all.min.js"></script>
<script src="../../static/js/common.js"></script>
</head>
<body>
	<div id="rrapp" v-cloak>
		<div v-show="showList">
			<div class="grid-btn form-inline">
				<a class="btn btn-primary" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</a>
				<a class="btn btn-primary" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</a>

				<div class="pull-right">
					<div class="form-group">
						<input type="text" class="form-control" v-model="q.dName"
							@keyup.enter="query" placeholder="医生姓名">
					</div>
					<a class="btn btn-primary " @click="query">查询</a>
				</div>
			</div>
			<table id="jqGrid"></table>
			<div id="jqGridPager"></div>
		</div>

		<div v-show="!showList" class="panel panel-default">
			<div class="panel-heading">{{title}}</div>
			<div class="panel-body">
				<form class="form-horizontal">
					<div class="form-group">
						<label>姓名</label> <input type="text" class="form-control"
							v-model="patientinfo.pname" placeholder="姓名" />
					</div>
					<div class="form-group">
						<label>身份证号</label> <input type="text" class="form-control"
							v-model="patientinfo.identity" placeholder="身份证号" />
					</div>
					<!-- <div class="form-group">
						<label>性别</label> <input type="text" class="form-control"
							v-model="patientinfo.psex" placeholder="性别" />
					</div> -->
					<!-- <div class="form-group">
						<label>性别</label> <input type="radio" id="personSex1" value="1"
							name="psex" v-bind:checked='radio_checked_personSex'> <label
							for="personSex1">男</label> <input type="radio" id="personSex0"
							value="0" name="psex" v-bind:checked='!radio_checked_personSex'>
						<label for="personSex0">女</label>
					</div>
					<div class="form-group">
						<label>年龄</label> <input type="text" class="form-control"
							v-model="patientinfo.age" placeholder="年龄" />
					</div> -->
					<!-- <div class="form-group">
						<label>主治医生</label> <input type="text" class="form-control"
							v-model="patientinfo.dname" placeholder="主治医生" />
					</div> -->
					<div class="form-group">
						<label>主治医生</label> <select name="dname" class="form-control">
							<template v-for="option in doctorOptions">

							<option :value="option[0]">{{ option[1] }}</option>
							</template>
						</select>
					</div>
					<!-- <div class="form-group">
						<label>就诊科室</label> <input type="text" class="form-control"
							v-model="patientinfo.department" placeholder="就诊科室" />
					</div> -->
					<!-- <div class="form-group">
						<label>就诊时间</label> <input type="date" class="form-control"
							v-model="patientinfo.treatdate" placeholder="就诊时间" />
					</div> -->
					<div class="form-group">
						<label>入院时间</label> <input type="date" class="form-control" value=""
							v-model="patientinfo.arrivedate" placeholder="入院时间" />
					</div>
					<div class="form-group">
						<label>就诊费用</label> <input type="number" class="form-control"
							v-model="patientinfo.totalcost" placeholder="就诊费用"/>
					</div>
					<div class="form-group">
						<label>备注</label> <input type="text" class="form-control"
							v-model="patientinfo.notes" placeholder="备注" />
					</div>
					<div class="form-group">
						<div class="col-sm-2 control-label"></div>
						<input type="button" class="btn btn-primary" @click="saveOrUpdate"
							value="确定" /> &nbsp;&nbsp;<input type="button"
							class="btn btn-warning" @click="reload" value="返回" />
					</div>
				</form>
			</div>
		</div>
	</div>

	<script src="../../static/js/modules/patientinfo.js"></script>
	<script type="text/javascript">
		//性别
		$("input[type='radio']").change(function() {
			vm.radio_checked = !vm.radio_checked;
			vm.patientinfo.psex = $(this).val();
		});
		//主治医生选择
		$("select[name='dname']").change(function() {
			var arr = ($(this).val()).split(',');//注split可以用字符或字符串分割  
			vm.patientinfo.dno = arr[0];
			vm.patientinfo.dname = $(this).find("option:selected").text();
			vm.patientinfo.department = arr[1];
		});
		//日期选择
		$("input[type='date']").change(function() {
			if ($(this).val() < writeCurrentDate()){
				alert("入院时间不得早于当前时间");
				vm.patientinfo.arrivedate=writeCurrentDate();
			}else{
				vm.patientinfo.arrivedate=$(this).val();
			}
				
		});
		//获取当天日期
		function writeCurrentDate() {
			var now = new Date();
			var year = now.getFullYear(); //得到年份
			var month = now.getMonth();//得到月份
			var date = now.getDate();//得到日期
			var week;
			month = month + 1;
			if (month < 10)
				month = "0" + month;

			var time = "";
			time = year + "-" + month + "-" + date;
			return time;

		}
	</script>
</body>
</html>